import request from '@/utils/request'

// 查询商城优惠券列表
export function listCoupon(query) {
  return request({
    url: '/manager/promotion/coupon/list',
    method: 'get',
    params: query
  })
}

// 查询商城全部优惠券列表
export function listCouponAll(query) {
  return request({
    url: '/manager/promotion/coupon/listAll',
    method: 'get',
    params: query
  })
}

// 查询商城优惠券详细
export function getCoupon(id) {
  return request({
    url: '/manager/promotion/coupon/' + id,
    method: 'get'
  })
}

// 新增商城优惠券
export function addCoupon(data) {
  return request({
    url: '/manager/promotion/coupon',
    method: 'post',
    data: data
  })
}

// 修改商城优惠券
export function updateCoupon(data) {
  return request({
    url: '/manager/promotion/coupon',
    method: 'put',
    data: data
  })
}

// 删除商城优惠券
export function delCoupon(id) {
  return request({
    url: '/manager/promotion/coupon/' + id,
    method: 'delete'
  })
}

// 启用商城优惠券
export function enableCoupon(id) {
  return request({
    url: '/manager/promotion/coupon/enable/' + id,
    method: 'post'
  })
}

// 关闭商城优惠券
export function closeCoupon(ids) {
  return request({
    url: '/manager/promotion/coupon/close/' + ids,
    method: 'post'
  })
}

// 作废商城优惠券
export function nullifyCoupon(ids) {
  return request({
    url: '/manager/promotion/coupon/nullify/' + ids,
    method: 'post'
  })
}
